//alert("myid:"+$.cookie("MYID"));
//alert("openid:"+$.cookie("myopenid"));
//跳转 历史定位
var newscanclick=true;//防止多次点击
function newsgohref(e){
    if(e.dataset.id&&newscanclick){
        newscanclick=false;
        var neid=e.dataset.id;
        var pcUrl=true;
        var errorUrl=/环球网|1905电影网|中国会计视野|编织人生网|IT之家|优姿美女/;
        if(e.dataset.sitename){
            if(errorUrl.test(e.dataset.sitename)){pcUrl=false;}
        }
        //增加点击数
        $.ajax({
            type:"post",
            datatype:"json",
            url:addcounturl,
            data:{"newsId":neid},
            success:function(d){
                newscanclick=true;
                newscanclick=true;
                if(pcUrl){
                    location.href="newsdetail.html?newsid="+neid+"#fromuser="+id;
                }
                else{
                    location.href="http://www.pulu.com/weixin/newsdetail.html?newsid="+neid+"#fromuser="+id;
                }
            }
        });
    }
}

if(!$.cookie("MYID")||$.cookie("MYID")=="undefined"){
    location.href="http://www.pulu.com/weixin/login.html";
}
var id= $.cookie("MYID");
//消息通知
if($.cookie("MYID")){
    if($.cookie("mynotic")=="loaded"){//新消息已经看过
        //不加载
    }else{
        $.ajax({
            type:"get",
            url:getanswernumurl+id,
            datatype:"json",
            success:function(d){
                console.log(d);
                if(d.Data>0){
                    $("#answernotic div span").html(d.Data);
                    $("#answernotic").css("display","block");
                    $("#newnotenotice").css("display","block");
                    $("#newnotenotice").html(d.Data);
                }else{
                    $("#answernotic").css("display","none");
                }
            }
        });
    }
}

//切换 个人动态
var lastNoteUrl="https://www.pulu.com/webapi/api/puluuser/GetThreeLog?userId="+id+"&currentIndex=1&pageSize=3";
var singleNoteUrl="https://www.pulu.com/webapi/api/PuluQuestion/GetMyDszyProc_e?userId="+id+"&currentIndex=1&pageSize=3";
var filmNoteUrl="https://www.pulu.com/webapi/api/PuluQuestion/GetMyDyplProc_e?userId="+id+"&currentIndex=1&pageSize=3";
var workNoteUrl="https://www.pulu.com/webapi/api/PuluQuestion/GetMyGzjhProc_e?userId="+id+"&currentIndex=1&pageSize=3";
var houseNoteUrl="https://www.pulu.com/webapi/api/PuluQuestion/GetMyZfxxProc_e?userId="+id+"&currentIndex=1&pageSize=3";
var myresourceurl="https://www.pulu.com/webapi/api/puluquestion/GetMyzyProc_e?userid="+id+"&currentIndex=1&pageSize=3";
//$("#personalType").click(function(){
//    $("#personalType .select").toggle();
//});
//$("#personalType .select .option").bind("click",function(e){
//    var eve=arguments.callee.caller.arguments[0]||event;
//    if (eve && eve.stopPropagation) {
//        eve.stopPropagation();
//    } else if (window.event) {
//        window.event.cancelBubble = true;
//    }
//    $("#personalType .select").hide();
//    var choiceId=e.target.id;
//    switch (choiceId){
//        case "goPersonal":
//            $.cookie("setpageLastNoteType","last");
//            $("#personalType>span").html("个人动态");
//            $("#lastinfopage span").html("最新动态");
//            $("#sixnum div").remove();
//            getLastNote(lastNoteUrl);
//            break;
//        case "goResource":
//            $.cookie("setpageLastNoteType","goResource");
//            $("#personalType>span").html("个人资源");
//            $("#lastinfopage span").html("最新资源");
//            $("#sixnum div").remove();
//            getLastNote(myresourceurl);
//            break;
//    }
//    console.log(e.target.id);
//});
//

$("#myfriend").click(function(){
    $("#QRcode").css("display","block");
    $("#page_wrapper").css("display","none");
});

//充值
$("#Recharge").click(function(){
    if(is_weixn()){
        location.href="http://www.pulu.com/weixin/recharge.html";
    }else{
        location.href="http://www.pulu.com/weixin/rechargepc.html";
    }
});
$("#expshowlistbtn").click(function(){location.href="questionlistjy.html";});
<!--模态框淡入淡出-->
var overflowlist=document.getElementsByClassName("overflow");
var modalbg=document.getElementsByClassName("modal_bg")[0];
var modal=document.getElementsByClassName("action_menu_container")[0];
var cancel=document.getElementById("cancel");
var timer;
for(var i=0;i<overflowlist.length;i++){
    overflowlist[i].onclick=function(){
        modalbg.style.display="block";
        modal.style.display="block";
        $("body").attr("class","mweb overflow");
    }
};
cancel.onclick=function(){
    if(modalbg.style.display=="block"&&modal.style.display=="block"){
        modalbg.className+=' animate_out';
        modal.className+=' animate_out';
        $("body").attr("class","mweb");
    }
    timer=setTimeout(changeclass,100);
};
function changeclass(){
    modalbg.className='modal_bg';
    modal.className='action_menu_container';
    clearTimeout();
    timer=null;
    changedisplay();
};
function changedisplay(){
    modalbg.style.display="none";
    modal.style.display="none";
};

$(".mweb_modal_back_button.lf").click(function(){
    history.go(-1);
});

//编辑资料 页面跳转
document.getElementById("bjzl").onclick=function(){
    modalbg.className+=' animate_out';
    modal.className+=' animate_out';
    timer=setTimeout(changeclass,100);
    $("body").attr("class","mweb");
    location.href="mysetpage.html";
};
//屏蔽管理 页面跳转
$("#pbgl").click(function(){
    location.href="shieldpage.html";
});
//个人账户
document.getElementById("myscore").onclick=function(){
    location.href="scoredetail.html";
};
//历史消息
$("#hisNote").click(function(){
    location.href="mynotichistory.html?fromchatpage=0";
});
//fan
$("#logo1").click(function(){
    if($.cookie("MYID")){
        var ref=document.referrer;
        if(ref&&!/mynotic/.test(ref)&&!/mysetpage/.test(ref)&&!/setpageInfo/.test(ref)){
            history.go(-1);
        }else{
            location.href="pulu.html";
        }
    }
});
//我的问题 页面跳转
$("#myaskbtn").click(function(){
    location.href="myquestionlist.html";
});
//我的回答 页面跳转
$("#myanswerbtn").click(function(){
    location.href="myquestionlist2.html";
});
//我的经验 页面跳转
$("#myexpbtn").click(function(){
    location.href="myquestionlist1.html";
});
//我的资源 页面跳转
$("#myresbtn").click(function(){
    location.href="myResList.html";
});
//我的资讯 页面跳转
$("#mysendnewsbtn").click(function(){
    location.href="myNewsList.html";
});
//我的收藏 页面跳转
$("#mycollectbtn").click(function(){
    location.href="myquestionlist5.html";
});
//退出登录
$("#signout").click(function(){
    localStorage.clear();
    $("body").attr("class","mweb");
    if($.cookie("wxopenid")){

        $.ajax({
            type:"post",
            url:opendeluser,
            data:{"openId":$.cookie("wxopenid")},
            success:function(d){
                id="";
                $(".action_menu_container").css("display","none");
                $(".modal_bg").css("display","none");

                $.cookie("MYAVA","");
                $.cookie("MYID","");
                $.cookie("MYNICK","");
                $.cookie("changeQue","");
                $.cookie("comfrom","");
                $.cookie("eid","");
                $.cookie("fromuser","");
                $.cookie("pexpid","");
                $.cookie("pexpuid","");
                $.cookie("pulucurrentIndex","");
                $.cookie("pulutype","");
                $.cookie("sharenewsid","");
                $.cookie("newsid","");
                $.cookie("selectType","");//经验类别
                $.cookie("searchType","");
                $.cookie("wx","");//微信首页地址中有code进行判断
                $.cookie("shareNewsListScroll","");
                $.cookie("lastInfoIndex","");
                $.cookie("lastInfoScroll","");
                $.cookie("setpageLastNoteType","");
                $.cookie("issignout","退出登录");
                $.cookie("validateLevel","");
                location.href="http://www.pulu.com/weixin/login.html#signout";
            }
        });
    }
    else{
        id="";
        $(".action_menu_container").css("display","none");
        $(".modal_bg").css("display","none");

        $.cookie("MYAVA","");
        $.cookie("MYID","");
        $.cookie("MYNICK","");
        $.cookie("changeQue","");
        $.cookie("comfrom","");
        $.cookie("eid","");
        $.cookie("fromuser","");
        $.cookie("pexpid","");
        $.cookie("pexpuid","");
        $.cookie("pulucurrentIndex","");
        $.cookie("pulutype","");
        $.cookie("sharenewsid","");
        $.cookie("newsid","");
        $.cookie("shareNewsListScroll","");
        $.cookie("lastInfoIndex","");
        $.cookie("lastInfoScroll","");
        $.cookie("setpageLastNoteType","");
        $.cookie("issignout","退出登录");
        location.href="http://www.pulu.com/weixin/login.html#signout";
    }
});

var haveimg="no";//控制能否点击头像
//关闭大图
$("#digimgplace").click(function(){
    $("#digimgplace").css("display","none");
    $("#page_wrapper").css("display","block");
});
//加载中定位
var wh=window.screen.availHeight;
var marginheight=(wh-80)/2;
//$("#waitplace>div").css("marginTop",marginheight+"px");
//最新动态列表页
$("#lastinfopage").click(function(){
    $.cookie("otherid","");
    location.href="lastinfo.html";
});
//别人回复提醒 详情页
$("#answernotic div").click(function(){
    $.cookie("noticdelid","firstin");

    location.href="mynotic.html";
});
//展示加载图片
function showloadimg(e){
    $(e).css("display","block");
}
//时间 几天前 几分钟前
function getDateTimeStamp(dateStr){
    dateStr=dateStr.match(/[0-9\-T\:]+/)[0].replace(/T/g,' ');
    return Date.parse(dateStr.replace(/-/gi,"/"));
};
function getDateDiff(dateTimeStamp){
    var minute = 1000 * 60;
    var hour = minute * 60;
    var day = hour * 24;
    var halfamonth = day * 15;
    var month = day * 30;
    var now = new Date().getTime();
    var diffValue = now - dateTimeStamp;
    if(diffValue < 0){return;}
    var monthC =diffValue/month;
    var weekC =diffValue/(7*day);
    var dayC =diffValue/day;
    var hourC =diffValue/hour;
    var minC =diffValue/minute;
    if(monthC>=1){
        result="" + parseInt(monthC) + "月前";
    }
    else if(weekC>=1){
        result="" + parseInt(weekC) + "周前";
    }
    else if(dayC>=1){
        result=""+ parseInt(dayC) +"天前";
    }
    else if(hourC>=1){
        result=""+ parseInt(hourC) +"小时前";
    }
    else if(minC>=1){
        result=""+ parseInt(minC) +"分钟前";
    }else
        result="刚刚";
    return result;
};
//最新三条
function getLastNote(ajurl){
    $.ajax({
        type:"get",
        datatype:"json",
        url:ajurl,
        //url:"https://www.pulu.com/webapi/api/puluuser/GetPulu_log_dealByUserId?userId="+id+"&currentIndex=1&pageSize=3",
        success:function(data){
            $("#setpagenewslist div").remove();
            for(var i=0;i<data.Data.length;i++){
                if(data.Data[i].title){
                    var tim=getDateDiff(getDateTimeStamp(data.Data[i].cTime));
                    if(!tim){tim="刚刚"};
                    if(data.Data[i].type===1){
                        $("#sixnum").append("<div class='pagedlist_item'> <div class='feed_item feed_type_question' style='border-bottom:none;'><div class='ContentFooter QuestionFooter rt'> <span class='answer_count'>"+tim+"</span></div><h2 class='no_highlight'> <a class='question_link' onclick='newsgohref(this)' data-sitename='"+data.Data[i].sitename+"' data-id='"+data.Data[i].qid+"'>"+data.Data[i].title+"</a></h2></div></div>");
                    }
                    else if(data.Data[i].type===2){
                        $("#sixnum").append("<div class='pagedlist_item'> <div class='feed_item feed_type_question' style='border-bottom:none;'><div class='ContentFooter QuestionFooter rt'> <span class='answer_count'>"+tim+"</span></div><h2 class='no_highlight'> <a class='question_link' href='questiondetail.html?qid="+data.Data[i].qid+"#fromuser="+id+"'>"+codetoface(data.Data[i].title)+"</a></h2></div></div>");
                    }
                    else{
                        if(data.Data[i].title){
                            $("#sixnum").append("<div class='pagedlist_item'> <div class='feed_item feed_type_question' style='border-bottom:none;'><div class='ContentFooter QuestionFooter rt'> <span class='answer_count'>"+tim+"</span></div><h2 class='no_highlight'> <a class='question_link' href='shareexppage.html?eid="+data.Data[i].qid+"#fromuser="+id+"'>"+codetoface(data.Data[i].title)+"</a></h2></div></div>");
                        }
                    }
                }
            }
            //$("#lastnewnote .InputMixin").before(code);
        }
    });
}
//关闭二维码
$("#QRcodeback").click(function(){
    $("#page_wrapper").css("display","block");
    $("#QRcode").css("display","none");
});
if($.cookie("MYID")){//加载页面
    $.ajax({
        type: "post",
        url: userurl,
        data: {"loginuserId": id,"userId":id},
        datatype: "json",
        success: function (data) {
            $.cookie("MYNICK",data.Data.userNick);
            $.cookie("MYID",data.Data.userId);
            $.cookie("MYAVA",data.Data.userAva);
            //实名认证状态
            $.cookie("validateLevel",data.Data.validateLevel);
            //公司排名
            if(data.Data.companyRank){
                switch(data.Data.companyRank){
                    case 4 : $("#companyLevelNum").html("前10%");break;
                    case 3 : $("#companyLevelNum").html("前11%-30%");break;
                    case 2 : $("#companyLevelNum").html("前31%-60%");break;
                    case 1 : $("#companyLevelNum").html("前61%-99%");break;
                }
            };
            //职能级别
            if(data.Data.jobId){
                switch(data.Data.jobId){
                    case 3 : $("#stationName").html("管理岗，技术岗");break;
                    case 2 :
                        $("#stationName").html("技术岗");
                        $("#manayeLevelDiv").css("display","none");
                        break;
                    case 1 :
                        $("#stationName").html("管理岗");
                        $("#keyWordDiv").css("display","none");
                        break;
                }
                if(data.Data.jobId!=1){
                    var len=data.Data.userTechKeyWords.length;
                    for(var a=0;a<len;a++){
                        var rankWord="";
                        switch(data.Data.userTechKeyWords[a].tecRank){
                            case 4 : rankWord="前10%";break;
                            case 3 : rankWord="前11%-30%";break;
                            case 2 : rankWord="前31%-60%";break;
                            case 1 : rankWord="前61%-99%";break;
                        }
                        $("#keyWordDiv").append(
                            '<div>' +
                            '<span>'+data.Data.userTechKeyWords[a].keyword+'</span>' +
                            '<span class="rt">'+rankWord+'</span>' +
                            '</div>'
                        )
                    }
                    len=null;a=null;rankWord=null;
                }
            };
            //累计
            $.cookie("cumulative",data.Data.earnScore+","+data.Data.totalrechare+","+data.Data.expenditure+","+data.Data.totaldesposit);
            //等待区域隐藏
            $("#waitplace").css("display","none");
            $("#page_title").html(data.Data.userNick);
            $("#QRcode .title .nickword").html(data.Data.userNick);
            $("#nickname").html(data.Data.userNick);
            //$("title").html("Pulu-"+data.Data.userNick);
            $("title").html("Pulu-我的铺路");
            if(data.Data.userAva){
                haveimg="yes";
                $("#photo img").attr("src","http://42.62.66.198:8003/"+data.Data.userAva);
                $("#QRcode .img img").attr("src","http://42.62.66.198:8003/"+data.Data.userAva);
                $("#digimgplace").css("background-image","url('http://42.62.66.198:8003/"+data.Data.userAva+"')");
            }else{
                $(".photo").append("<img class='profile_photo_img' src='img/af8.png' onload='showloadimg(this)' style='display:none;'>");
                $("#QRcode .img img").attr("src","img/af8.png");
                $("#digimgplace").css("background-image","url('http://img/af8.png')");
            }
            //二维码
            if(data.Data.userQrCode){
                $(".QRbody img").attr("src","http://42.62.66.198:8003/"+data.Data.userQrCode);
            }
            else{$("#myfriend").css("display","none")}

            if(data.Data.userSex===1){
                document.getElementById("sex1").style.display="inline-block";
                $("#QRcode .title .sex1").css("display","inline-block");
            }else if(data.Data.userSex===0){
                document.getElementById("sex2").style.display="inline-block";
                $("#QRcode .title .sex2").css("display","inline-block");
            }
            //if(data.Data.realName){$("#cover").html("("+data.Data.realName+")");}
            //$("#cover").html(data.Data.userLabel);
            $("#myword").html(data.Data.userSign);
            if(data.Data.locationCity&&data.Data.locationCity.length>0&&data.Data.locationCity!="null"){
                $("#city").html(data.Data.locationCity);
                $("#QRcode .title .loca").html(data.Data.locationCity);
            }
            $("#educationword").html(data.Data.userEducation);
            //var jobs=[];
            //if(data.Data.jobs&&data.Data.jobs.length>0){
            //    for(var i= 0;i<data.Data.jobs.length;i++){
            //        jobs.push(data.Data.jobs[i].typename);
            //    }
            //    jobs=jobs.join(" ");
            //}
            //$("#myjobs").html(jobs);

            var news=[];
            if(data.Data.userHit&&data.Data.userHit.length>0){
                for(var n= 0;n<data.Data.userHit.length;n++){
                    news.push("<span>"+data.Data.userHit[n].typename+"</span>");
                }
                news=news.join(" ");
            }
            //我的订阅
            $("#mynews").html(news);
            $("#progressionName").html(data.Data.newJobs);
            //var hobby=[];
            //if(data.Data.hobbys&&data.Data.hobbys.length>0){
            //    for(var r= 0;r<data.Data.hobbys.length;r++){
            //        hobby.push(data.Data.hobbys[r].typename);
            //    }
            //    hobby=hobby.join(" ");
            //}
            //$("#myhobby").html(hobby);
            if(data.Data.visitedCity){
                $("#visitedcity").html(data.Data.visitedCity);
            }
            ////铺路信息
            //$("#scoreword").html(Math.round(parseFloat(data.Data.score))/100+"元");
            //$.cookie("MYSCORE",Math.round(parseFloat(data.Data.score))/100);
            //$("#myquestionCount").html(data.Data.myQuestionCount+"条");
            //$("#myanswerCount").html(data.Data.myAnswerCount+"条");
            //$("#myexpCount").html(data.Data.myExpCount+"条");
            //$("#mycollecttionCount").html(data.Data.myCollectionCount+"条");
            //$("#myresCount").html(data.Data.ZyCount+"条");
            //$("#mysendnewsCount").html(data.Data.ZxCount+"条");
            ////陌生人可见
            //if(data.Data.strangeSeeStatus===1){//可见
            //    document.getElementById("seemeimg1").style.display="none";
            //    document.getElementById("seemeimg2").style.display="block";
            //}else if(data.Data.strangeSeeStatus===0){//不可见
            //    document.getElementById("seemeimg1").style.display="block";
            //    document.getElementById("seemeimg2").style.display="none";
            //}
            ////微信通知
            //if(is_weixn()){
            //    $(".AboutSection.setpageotherplace").css("display","block");
            //    $("#WXsenddiv").css("display","block");
            //    if(data.Data.isAceptMsg===1){//可见
            //        document.getElementById("weixinimg1").style.display="none";
            //        document.getElementById("weixinimg2").style.display="block";
            //    }else if(data.Data.isAceptMsg===0){//不可见
            //        document.getElementById("weixinimg1").style.display="block";
            //        document.getElementById("weixinimg2").style.display="none";
            //    }
            //}
        }
    });
    //最新三条动态 最新动态---------------
    if(!$.cookie("setpageLastNoteType")){
        getLastNote(lastNoteUrl);
    }else{
        if($.cookie("setpageLastNoteType")=="last"){
            $("#personalType>span").html("个人动态");
            $("#lastinfopage span").html("最新动态");
            $("#sixnum div").remove();
            getLastNote(lastNoteUrl);
        }
        else if($.cookie("setpageLastNoteType")=="goResource"){
            $("#personalType>span").html("个人资源");
            $("#lastinfopage span").html("最新资源");
            $("#sixnum div").remove();
            getLastNote(myresourceurl);
        }

    }
    ////同路人
    //$.ajax({
    //    type:"get",
    //    url:"https://www.pulu.com/webapi/api/puluuser/GetCommon3Users?userid="+id+"&currentIndex=1&pageSize=3",
    //    datatype:"json",
    //    success:function(d){
    //        console.log(d);
    //        if(d.Message=="0"|| d.Data.length==0){
    //
    //        }else{
    //            $("#felldiv").css("display","block");
    //            for(var i=0;i< d.Data.length;i++){
    //                var peopleimg="<img src='../img/af8.png'/>";
    //                if(d.Data[i].headimg){
    //                    peopleimg="<img src='http://42.62.66.198:8003/"+d.Data[i].headimg+"' onload='showloadimg(this)' style='display:none;'/>";
    //                }
    //                var thisUserRealName="";
    //                if(d.Data[i].realName){thisUserRealName="("+d.Data[i].realName+")"}
    //                $("#felllist").append("<div class='strpeople'><div class='strimg'><a href='otherpeoplepage.html?otherid="+d.Data[i].userId+"'>"+peopleimg+"</a></div><div class='strname'>"+d.Data[i].nick+"<p>"+thisUserRealName+"</p></div></div>");
    //            }
    //        }
    //
    //    }
    //});
    //$("#showallfell").click(function(){
    //    if($.cookie("MYID")){location.href="fellower.html"}
    //});
    //陌生人查看30条
    $("#seeme").click(function(){
        if(document.getElementById("seemeimg1").style.display==="block"){
            document.getElementById("seemeimg1").style.display="none";
            document.getElementById("seemeimg2").style.display="block";
            $.ajax({
                type:"post",
                datatype:"json",
                url:"https://www.pulu.com/webapi/api/PuluUser/OpenStrangerSee",
                data:{"userId":id},
                success:function(d){}
            })
        }else if(document.getElementById("seemeimg2").style.display==="block"){
            document.getElementById("seemeimg1").style.display="block";
            document.getElementById("seemeimg2").style.display="none";
            $.ajax({
                type:"post",
                datatype:"json",
                url:"https://www.pulu.com/webapi/api/PuluUser/CloseStrangerSee",
                data:{"userId":id},
                success:function(d){}
            })
        }
    });
    //微信公众号提醒
    $("#WXsend").click(function(){
        if(document.getElementById("weixinimg1").style.display==="block"){
            document.getElementById("weixinimg1").style.display="none";
            document.getElementById("weixinimg2").style.display="block";
            $.ajax({
                type:"post",
                datatype:"json",
                url:"https://www.pulu.com/webapi/api/puluuser/OpenAceptMsg",
                data:{"userId":id},
                success:function(d){}
            })
        }else if(document.getElementById("weixinimg2").style.display==="block"){
            document.getElementById("weixinimg1").style.display="block";
            document.getElementById("weixinimg2").style.display="none";
            $.ajax({
                type:"post",
                datatype:"json",
                url:"https://www.pulu.com/webapi/api/puluuser/CloseAceptMsg",
                data:{"userId":id},
                success:function(d){}
            })
        }
    });
}
else{
    location.href="http://www.pulu.com/weixin/login.html";
}

////环信建立连接
//var conn = new WebIM.connection({
//    https: WebIM.config.https,
//    url: WebIM.config.xmppURL,
//    isAutoLogin: WebIM.config.isAutoLogin,
//    isMultiLoginSessions: WebIM.config.isMultiLoginSessions
//});
////登录
//var options = {
//    apiUrl: WebIM.config.apiURL,
//    user:id,
//    pwd:id,
//    appKey: "pulu#pulu"
//};
//conn.open(options);
//var havingnewsnow="no";//当前没有好友信息
//var fromuserid;
////函数列队执行--------------------------------------
//var stack=[];//保存执行函数数组
//var messarrid=[];//保存信息 ↑stack中函数使用
//  //编写函数列队方法 next();
//function next(){
//    //执行最靠前的一个
//    var fn=stack[0];
//    if(typeof fn==="function")fn(messarrid[0]);
//}
////同意添加好友
//$("#iamagree").click(function(){
//    conn.subscribed({
//        to:fromuserid,
//        //message : "[resp:true]"
//        message :""
//    });
//    //关闭提示框
//    $("#friendInfor").css("display","none");
//    $.ajax({
//        type:"post",
//        datatype:"json",
//        url:"https://www.pulu.com/webapi/api/PuluGoodFriend/Addpulu_goodfriend",
//        data:{"userId":fromuserid,"friendId":id},
//        success:function(d){}
//    });
//    //将已经处理好的数据清除
//    stack.shift();
//    messarrid.shift();
//    //用户处理操作后再次调用next();
//    next();
//});
////拒绝添加好友
//$("#iampass").click(function(){
//    conn.unsubscribed({
//        to:fromuserid,
//        message : "拒绝"
//    });
//    $("#friendInfor").css("display","none");
//    stack.shift();
//    messarrid.shift();
//    next();
//});
////关闭消息通知
//$("#iknow2").click(function(){
//    $("#friendInfor2").css("display","none");
//    stack.shift();
//    messarrid.shift();
//    next();
//});
//conn.listen({
//    //事件监听（加好友通知）
//    onPresence: function ( e ) {
//        //只处理好友申请
//        //console.log(e);
//        if ( e.type === 'subscribe'&&(e.status!="[resp:true]") ){
//            //处理信息数据格式 方便调用
//            var mes={"type":e.type,"from":e.from,"status":e.status};
//            //将信息插入到数组中 进行保存
//            messarrid.push(mes);
//            //服务器传递数据
//            function sendfriendnot(e){
//                //console.log(e.from+":"+e.status);
//                //console.log(e);
//                if ( e.type === 'subscribe' ){
//                    $.ajax({
//                        type:"post",
//                        url:savefriendnoteurl,
//                        data:{"userId":id,"friendId":e.from,"msg":e.status},
//                        success:function(d){
//                            //console.log("传送数据成功");
//                            //console.log(d);
//                            stack.shift();
//                            messarrid.shift();
//                            next();
//                        }
//                    });
//                }
//            }
//            //将方法插入到数组中 列队执行
//            //stack.push(handlePresence);
//            stack.push(sendfriendnot);
//            //执行next()
//            next();
//        }
//
//    },
//    //收到联系人订阅请求、处理群组、聊天室被踢解散等消息
//    onOpened: function ( message ) {          //连接成功回调
//        //如果isAutoLogin设置为false，那么必须手动设置上线，否则无法收消息
//        conn.setPresence();
//        conn.getRoster({
//            success: function ( roster ) {
//                for ( var i = 0, l = roster.length; i < l; i++ ) {
//                    var ros = roster[i];
//                    //ros.subscription值为both/to为要显示的联系人，此处与APP需保持一致，才能保证两个客户端登录后的好友列表一致
//                    if ( ros.subscription === 'both' || ros.subscription === 'to' ) {
//                        //console.log(ros);
//                    }
//                }
//            },
//            error:function(d){
//                console.log(d);
//            }
//        });
//        //console.log("结束调用好友列表");
//    },
//    onClosed: function ( message ) {console.log("1");},         //连接关闭回调
//    onEmojiMessage: function ( message ) {console.log("2");},   //收到表情消息
//    onPictureMessage: function ( message ) {console.log("3");}, //收到图片消息
//    onCmdMessage: function ( message ) {console.log("4");},     //收到命令消息
//    onAudioMessage: function ( message ) {console.log("5");},   //收到音频消息
//    onLocationMessage: function ( message ) {console.log("6");},//收到位置消息
//    onFileMessage: function ( message ) {console.log("7");},    //收到文件消息
//    onVideoMessage: function ( message ) {console.log("8");},   //收到视频消息
//    onRoster: function ( message ) {console.log("10");},         //处理好友申请
//    onInviteMessage: function ( message ) {console.log("11");},  //处理群组邀请
//    onOnline: function () {console.log("12");},                  //本机网络连接成功
//    onOffline: function () {console.log("13");},                 //本机网络掉线
//    onError: function ( message ) {console.log("14");}           //失败回调
//});
////添加可能认识的人为好友
//function addfri(e){
//    if(e.className==="straddbtn"){
//        console.log(e.className);
//        e.className="straddbtn clicked";
//        //发送好友模板
//        $.ajax({
//            type:"post",
//            url:savefriendnoteurl0,
//            data:{"userId": $.cookie("MYID"),"friendId":e.dataset.uid,"msg":""},
//            success:function(d){
//
//            }
//        });
//        conn.subscribe({
//            to: e.dataset.uid,
//            message: $.cookie("MYNICK")+"请求添加你为好友"
//        });
//    }
//}
////查看共同好友
//function gotoshowpage(e){
//    location.href="relapeoplelist.html?otherid="+e.dataset.uid;
//}
////可能认识的人
//function gerstr(){
//    $.ajax({
//        type:"get",
//        url:getrelapeopleurl+id,
//        datatype:"json",
//        success:function(d){
//            if(d.Message=="0"){
//
//            }else{
//                $("#reladiv").css("display","block");
//                for(var i=0;i< d.Data.length;i++){
//                    var peopleimg="<img src='../img/af8.png'/>";
//                    if(d.Data[i].userAva){
//                        peopleimg="<img src='http://42.62.66.198:8003/"+d.Data[i].userAva+"' onload='showloadimg(this)' style='display:none;'/>";
//                    }
//                    var thisUserRealName="";
//                    if(d.Data[i].realName){thisUserRealName="("+d.Data[i].realName+")"}
//                    $("#strdiv").append("<div class='strpeople'><div class='strimg'><a href='otherpeoplepage.html?otherid="+d.Data[i].userId+"'>"+peopleimg+"</a></div><div class='strname'>"+d.Data[i].userNick+"<p>"+thisUserRealName+"</p></div> <div class='strnum' data-uid='"+d.Data[i].userId+"' onclick='gotoshowpage(this)'>"+d.Data[i].commonCount+"个共同好友</div> <div class='straddbtn' data-uid='"+d.Data[i].userId+"' onclick='addfri(this)'>+加好友</div> </div>");
//                }
//            }
//
//        }
//    });
//};
//gerstr();
//换一换 可能认识的人
var strdiv=document.getElementById("strdiv");//好友推荐部分 可能认识的人
var divheight;
//$("#changestrbtn").click(function(){
//    if(typeof window.getComputedStyle!='undefined'){
//        divheight=window.getComputedStyle(strdiv)["height"];
//    }else if(strdiv.currentStyle){
//        divheight=parseInt(strdiv.currentStyle["height"]);
//    };
//    $("#strdiv").css("height",divheight);
//    $("#strdiv div").remove();
//    gerstr();
//});
////查看全部好友
//$("#showallstr").click(function(){
//    location.href="relapeoplelist.html?showallrela";
//});
//拒绝提醒框关闭
$("#ikonw2").click(function(){
    $("#friendInfor2").css("display","none");
});